package com.dzt.cloudreader.fragment;

import android.os.Bundle;
import android.support.v7.widget.DefaultItemAnimator;
import android.support.v7.widget.StaggeredGridLayoutManager;

import com.dzt.cloudreader.R;
import com.dzt.cloudreader.base.LoadingFragment;
import com.dzt.xrecyclerview.XRecyclerView;

import butterknife.BindView;

/**
 * Created by M02323 on 2018/1/16.
 */

public class BookCustomFragment extends LoadingFragment {
    private static final String TYPE = "mType";
    @BindView(R.id.xrv_book)
    XRecyclerView recyclerView;
    private String mType = "文化";
    private int mPage = 1;


    public static AndroidFragment newInstance(String type) {
        AndroidFragment fragment = new AndroidFragment();
        Bundle args = new Bundle();
        args.putString(TYPE, type);
        fragment.setArguments(args);
        return fragment;
    }

    @Override
    protected int getLayoutId() {
        return R.layout.fragment_book_custom;
    }

    @Override
    protected void initData() {
        if (getArguments() != null) {
            mType = getArguments().getString(TYPE);
        }
    }

    private void initRecyclerView() {
//        recyclerView.setPullRefreshEnabled(false);
//        recyclerView.setLoadingMoreEnabled(true);
//        recyclerView.clearHeader();
//        //构造器中，第一个参数表示列数或者行数，第二个参数表示滑动方向,瀑布流
//        recyclerView.setLayoutManager(new StaggeredGridLayoutManager(3,
//                StaggeredGridLayoutManager.VERTICAL));
//        // 需加，不然滑动不流畅
//        recyclerView.setNestedScrollingEnabled(false);
//        recyclerView.setHasFixedSize(false);
//        recyclerView.setItemAnimator(new DefaultItemAnimator());
//        recyclerView.setAdapter(adapter);
//        recyclerView.setLoadingListener(new XRecyclerView.LoadingListener() {
//            @Override
//            public void onRefresh() {
//
//            }
//
//            @Override
//            public void onLoadMore() {
//                mStart += mCount;
//                loadDouBanTop250();
//            }
//        });
    }
}
